const babel = require("@babel/core");

let prx = `const fn = (arr) => arr.map(item => item + 1)`;

const options = {};
const result = babel.transform(prx, options);
console.log(result.code);